<template></template>

<script>
import { $login } from "../api/admin";
import { useRouter } from "vue-router";
export default {
  name: "home",
  setup() {
    let $router = useRouter();
    //tips:这里单词注意拼写
    let loginId = localStorage.getItem("loginId");
    let loginPwd = localStorage.getItem("loginPwd");
    if (loginId && loginPwd) {
      $login({
        loginId,
        loginPwd,
      }).then((r) => {
        if (r) {
          $router.push("/layout");
        }
      });
    } else {
      $router.push("/login");
    }
  },
};
</script>

<style>
</style>